#include "cobra11syndicate.hlsli"
#include "..\\standard.hlsli"

PS_Input_C11 vs_main(
	float4 v0 : Position /* dcl_position v0 */,
	float4 v1 : normal /* dcl_normal v1 */,
	float4 v2 : texcoord /* dcl_texcoord v2 */,
	float4 v3 : texcoord1 /* dcl_texcoord1 v3 */,
	float4 v4 : color1 /* dcl_color v4 */,
	float4 v5 : color0 /* dcl_color1 v5 */
	)
{

	float4 c0 = float4(2, -1, -1.44269502, -0); // def c0, 2, -1, -1.44269502, -0

	PS_Input_C11 psIn = (PS_Input_C11)0;
		float4 r0 = (float4)0;
		float4 r1 = (float4)0;
		float4 r2 = (float4)0;
		float4 r3 = (float4)0;
		float4 r4 = (float4)0;
		float4 r5 = (float4)0;

		r0.xyz = v1.xyz * c0.x + c0.y;//mad r0.xyz, v1, c0.x, c0.y
	r0.w = dot(r0.xyz, r0.xyz);//dp3 r0.w, r0, r0
	r0.w = rsqrt(r0.w);//rsq r0.w, r0.w
	psIn.normal.xyz = r0.w * r0.xyz;//mul o3.xyz, r0.w, r0
	r0.xyzw = WorldOffset.xyzw + v0.xyzw;//add r0, c33, v0
	psIn.position.x = dot(r0.xyzw, worldViewProj._m00_m10_m20_m30);// dp4 o0.x, r0, c20
	psIn.position.y = dot(r0.xyzw, worldViewProj._m01_m11_m21_m31);// dp4 o0.y, r0, c21
	psIn.position.z = dot(r0.xyzw, worldViewProj._m02_m12_m22_m32);// dp4 o0.z, r0, c22
	psIn.position.w = dot(r0.xyzw, worldViewProj._m03_m13_m23_m33);// dp4 o0.w, r0, c23
	psIn.texCoord7.w = dot(r0.xyzw, view._m02_m12_m22_m32);// dp4 o7.w, r0, c11
	r1.xyz = r0.xyz + -g_CameraPosition.xyz;//add r1.xyz, r0, -c32
	r1.xyz = r1.xyz * RangeFog.w;//mul r1.xyz, r1, c31.w
	r0.w = dot(r1.xyz, r1.xyz);//dp3 r0.w, r1, r1
	r0.w = r0.w * c0.z;//mul r0.w, r0.w, c0.z
	psIn.distanceToCamera.w = exp(r0.w);//exp o4.w, r0.w
	r1.xyz = v5.xyz * v5.xyz;//mul r1.xyz, v5, v5
	r1.xyz = r1.xyz * AmbLevel.xyz;//mul r1.xyz, r1, c30
	r1.w = v5.w;//mov r1.w, v5.w
	psIn.diffuseColor.xyzw = r1.xyzw + TerrainAmbient.xyzw;//add o2, r1, c48
	r1.xyz = v2.xyx * -c0.yyw + -c0.wwy;//mad r1.xyz, v2.xyxw, -c0.yyww, -c0.wwyw
	r2.x = dot(r1.xyz, TexMat1._m00_m10_m20);//dp3 r2.x, r1, c34
	r2.y = dot(r1.xyz, TexMat1._m01_m11_m21);//dp3 r2.y, r1, c35
	psIn.texCoord5.zw = r2.xy * TexUVMod1.z + TexUVMod1.xy;//mad o5.zw, r2.xyxy, c38.z, c38.xyxy
	psIn.texCoord5.xy = r2.xy;//mov o5.xy, r2
	r1.xyz = v3.xyx * -c0.yyw + -c0.wwy;//mad r1.xyz, v3.xyxw, -c0.yyww, -c0.wwyw
	r2.x = dot(r1.xyz, TexMat2._m00_m10_m20);//dp3 r2.x, r1, c36
	r2.y = dot(r1.xyz, TexMat2._m01_m11_m21);//dp3 r2.y, r1, c37
	psIn.texCoord6.zw = r2.xy * TexUVMod2.z + TexUVMod2.xy;//mad o6.zw, r2.xyxy, c39.z, c39.xyxy
	psIn.texCoord6.xy = r2.xy;//mov o6.xy, r2
	psIn.distanceToCamera.xyz = -r0.xyz + g_CameraPosition.xyz;//add o4.xyz, -r0, c32
	r0.xyzw = r0.xyzx * -c0.yyyw + -c0.wwwy;//mad r0, r0.xyzx, -c0.yyyw, -c0.wwwy
	psIn.texCoord8.x = dot(r0.xyzw, ShadowMtx._m00_m10_m20_m30);// dp4 o8.x, r0, c24
	psIn.texCoord8.y = dot(r0.xyzw, ShadowMtx._m01_m11_m21_m31);// dp4 o8.y, r0, c25
	psIn.texCoord8.z = dot(r0.xyzw, ShadowMtx._m02_m12_m22_m32);// dp4 o8.z, r0, c26
	psIn.texCoord7.xyz = r0.xyz;//mov o7.xyz, r0
	psIn.VertexColor.xyzw = v4.xyzw;//mov o1, v4


	return psIn;
}
